package com.grace.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.grace.entity.Item;
import com.grace.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/item")
public class ItemController {

    @Autowired
    private ItemService itemService;


    @GetMapping("/list")
    public String list(Model model) {
        //TODO 查询商品列表
        Page<Item> page = itemService.page(new Page<>(1, 3));
        model.addAttribute("page", page);
        return "list";
    }
}
